<?php
define('APPGROUPGROUPS','1.00');
/************************************************************************/
/* FrameWork  test preview                                              */
/* ==================================================================== */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/************************************************************************/
//carica la lingua se esiste
$lang=lang();
if (file_exists("applications/$appname/lang/$lang.inc"))
    include "applications/$appname/lang/$lang.inc";
else
    include "applications/$appname/lang/it.inc";
?>

	<?php if (admin_isadmin()){
	    admin_writelog("admin:modify group-groups");
	    //echo "appname=$appname<br/>";

	?>
	    <h3><?=_GROUPS;?></h3><hr />
	    <div id="groups" >
		<form name='sel_group' action='index.php'>
		    <input type='hidden' name='appname' value='<?=$appname?>' />
		    <input type='hidden' name='op' value='group-groups' />
		    <?php $group=$_GET['group'];?>
		    <b><?=_SEL_GROUP;?></b> <select name='group' style="width:50%">
			<option><?=$group ?></option>

			<?php
			    $listgroups=group_listgroups();
			    foreach( $listgroups as $selgroup){
				if($selgroup!=$group)
				    echo("<option>$selgroup</option>\n");
			    }
			?>
		    </select>
		<input type='submit' value='<?=_GO;?>' />
	    </form>
	<hr />

	<table border="1" width="100%">
	    <tr>
		<td width="50%">
		    <form name='remove_group' action='index.php'>
			<input type='hidden' name='appname' value='<?=$appname?>' />
			<input type='hidden' name='group_op' value='removeuser' />
			<input type='hidden' name='group' value=<?=$group ?> />
			<input type='hidden' name='op' value='group-groups' />
			<select name='user' size='5' style="width:100%; border-color:0;">
			    <?php
				$listgrpusr=@file("datas/sb/".sb_get()."/group/groups/$group");
				foreach( $listgrpusr as $usersel){
				    if($usersel!=$user)
					echo("<option>$usersel</option>\n");
				}
			    ?>
			</select>
			<br />
			<br />
			<center><input type='submit' value='<?=_DEL_GROUP;?>' /></center>
		    </form>

		</td>
		<td width="50%">
		    <form name='add_group' action='index.php' >
			<input type='hidden' name='appname' value='<?=$appname?>' />
			<input type='hidden' name='group_op' value='adduser' />
			<input type='hidden' name='group' value=<?=$group ?> />
			<input type='hidden' name='op' value='group-groups' />
			<select name='user' size='5' style="width:100%; border-color:0;">
			    <?php
				$listusr=user_listusers();
				foreach( $listusr as $usrsel){
				    if(!in_array($usrsel."\n",$listgrpusr) )
					echo("<option>$usrsel</option>\n");
				}
			    ?>
			</select>
			<br />
			<br />
			<center><input type='submit' value='<?=_ADD_GROUP;?>' /></center>
		    </form>
		</td>
	    </tr>
	</table>
    </div>
      <?php  } ?>
